using System;
using System.Collections.Generic;
using System.Text;
using DTO;
using System.Data;
namespace BUS
{
    public enum ChucVuBUSResult
    {
        OK ,
        DAOERROR
    }
    public class ChucVu
    {
        public static ChucVuBUSResult SelectAll(List<DTO.ChucVu> danhSach)
        {
            string sql = "select * from ChucVu";
            DAO.Interface cv = new DAO.ChucVu();
            DataTable dt = cv.Select(sql);
            if (dt != null)
            {
                for (int i = 0 ; i < dt.Rows.Count ; i++)
                {
                    DTO.ChucVu temp = new DTO.ChucVu();
                    temp.MaChucVu = dt.Rows[i].ItemArray[0].ToString().Trim();
                    temp.TenChucVu = dt.Rows[i].ItemArray[1].ToString();
                    danhSach.Add(temp);
                }
                return ChucVuBUSResult.OK;
            }
            return ChucVuBUSResult.DAOERROR;
        }
        public static bool Insert(string sql)
        {
            DAO.ChucVu bc = new DAO.ChucVu();
            return bc.Insert(sql);
        }
        public static bool Update(string sql)
        {
            DAO.ChucVu bc = new DAO.ChucVu();
            return bc.Update(sql);
        }
        public static bool Delete(string sql)
        {
            DAO.ChucVu bc = new DAO.ChucVu();
            return bc.Delete(sql);
        }
        public static DataTable Select(string sql)
        {
            DAO.ChucVu bc = new DAO.ChucVu();
            return bc.Select(sql);
        }

        public static string LayMaChucVu(string tenCV)
        {
            DAO.ChucVu bc = new DAO.ChucVu();
            return bc.LayMaChucVu(tenCV);
        }
    }
}
